//
//  LagouButton.m
//  作业2
//
//  Created by dllo on 16/7/16.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "LagouButton.h"

@implementation LagouButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

+ (LagouButton *)createButtonWithTitle:(NSString *)title
                       backgroundColor:(UIColor *)backgroundColor
                            titleColor:(UIColor *)titleColor
                                center:(CGPoint)center
                                 frame:(CGRect)frame
                           borderWidth:(CGFloat)borderWidth
                          cornerRadius:(CGFloat)cornerRadius
                           borderColor:(CGColorRef)borderColor {
    LagouButton *button = [LagouButton buttonWithType:UIButtonTypeCustom];
    button.frame = frame;
    [button setCenter:center];
    [button setBackgroundColor:backgroundColor];
    [button setTitle:title forState:0];
    [button setTitleColor:titleColor forState:0];
    button.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [button.layer setBorderWidth:borderWidth];
    [button.layer setCornerRadius:cornerRadius];
    [button.layer setBorderColor:borderColor];
    return button;
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect {
    // contentRect的四个值对应该button的frame的四个值
    return CGRectMake(0, contentRect.size.height / 4, contentRect.size.width / 2, contentRect.size.height / 2);
}
@end
